<#include "/admin/include/macros.ftl">
<@header></@header>
<div class="clearfix"></div>
<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <@breadcrumb>
            <ol class="breadcrumb">
                <li><a href="${ctx.contextPath}/admin">首页</a></li>
                <li class="active">系统日志</li>
            </ol>
        </@breadcrumb>
        <div class="x_panel">
            <div class="x_content">
                <div class="<#--table-responsive-->">
                    <table id="tablelist">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<@footer>
    <script>
        /**
         * 操作按钮
         * @param code
         * @param row
         * @param index
         * @returns {string}
         */
        function operateFormatter(code, row, index) {
            var trId = row.id;
            var operateBtn = [
                '<a class="btn btn-sm btn-success btn-update" data-id="' + trId + '"title="查看"><i class="fa fa-edit fa-fw"></i></a>',
            ];
            return operateBtn.join('');
        }

        $(function () {
            var options = {
                modalName: "系统日志",
                url: "${ctx.contextPath}/logs/list",
                getInfoUrl: "${ctx.contextPath}/logs/get/{id}",
                columns: [
                    {
                        checkbox: true
                    }, {
                        field: 'id',
                        title: 'ID',
                        width: '40px',
                        formatter: function (code) {
                            return code ? code : '-';
                        }
                    }, {
                        field: 'type',
                        title: '类型',
                        width: '130px',
                        formatter: function (code) {
                            return code ? code : '-';
                        }
                    }, {
                        field: 'content',
                        title: '内容',
                        width: '300px',
                        formatter: function (code) {
                            return code ? code : '-';
                        }
                    }, {
                        field: 'createTime',
                        title: '更新时间',
                        width: '100px'
                    }, {
                        field: 'operate',
                        title: '操作',
                        align: "center",
                        width: '80px',
                        formatter: operateFormatter //自定义方法，添加操作按钮
                    }
                ]
            };
            // 初始化table组件
            var table = new Table(options);
            table.init();
        });
    </script>
</@footer>